﻿using System;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;


namespace WinnerCMS.BLL
{
    /// <summary>
    /// 移除缓存
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class CacheRemoveAttribute : HandlerAttribute
    {
        /// <summary>
        /// 移除缓存
        /// </summary>
        public CacheRemoveAttribute()
        {
        }
        /// <summary>
        /// 移除缓存
        /// </summary>
        /// <param name="key"></param>
        public CacheRemoveAttribute(string key)
        {
            this.Key = key;
        }
        /// <summary>
        /// 缓存Id
        /// </summary>
        public string Key { get; set; }


        public override ICallHandler CreateHandler(IUnityContainer container)
        {
            //创建具体Call Handler，并调用
            CacheRemoveHandler handler = new CacheRemoveHandler(this.Key)
            {
                Order = this.Order
            };
            return handler;
        }
    }
}